package bg.tu.varna.pms.model.communication;

import java.io.Serializable;
import java.util.UUID;

public final class FileMessage {
	public final static long mBlockSize = 1024 << 2;

	public final static class Request implements Serializable {
		private static final long serialVersionUID = -5937003593237410747L;
		private final String mChatRoomID;
		private final UUID mFileID;
		private final String mFilename;
		private final long mFilesize;
		private final long mBlocks;

		public Request(String chatRoomID, String filename, long filesize) {
			mChatRoomID = chatRoomID;
			mFileID = UUID.randomUUID();
			mFilename = filename;
			mFilesize = filesize;
			mBlocks = mFilesize / mBlockSize;
		}

		public String getChatRoomID() {
			return mChatRoomID;
		}

		public UUID getFileID() {
			return mFileID;
		}

		public String getFilename() {
			return mFilename;
		}

		public long getFilesize() {
			return mFilesize;
		}

		public long getBlocks() {
			return mBlocks;
		}
	}

	public final static class Response implements Serializable {
		private static final long serialVersionUID = 6790943437671287340L;
		private final UUID mFileID;
		private final String mFilename;
		private final boolean mSuccess;

		public Response(UUID fileID, String filename, boolean success) {
			mFileID = fileID;
			mFilename = filename;
			mSuccess = success;
		}

		public UUID getFileID() {
			return mFileID;
		}

		public String getFilename() {
			return mFilename;
		}

		public boolean isSuccess() {
			return mSuccess;
		}
	}

	/**
	 * Receiver accept the file
	 * 
	 * @author Gospodin Gospodinov
	 */
	public final static class Accept implements Serializable {
		private static final long serialVersionUID = 754583815111452641L;
		private final UUID mFileID;
		private final String mFilename;

		public Accept(UUID fileID, String filename, boolean success) {
			mFileID = fileID;
			mFilename = filename;
		}

		public UUID getFileID() {
			return mFileID;
		}

		public String getFilename() {
			return mFilename;
		}
	}

	/**
	 * Receiver deny the file
	 * 
	 * @author Gospodin Gospodinov
	 */
	public final static class Deny implements Serializable {
		private static final long serialVersionUID = -7036756934817339269L;
		private final UUID mFileID;
		private final String mFilename;

		public Deny(UUID fileID, String filename, boolean success) {
			mFileID = fileID;
			mFilename = filename;
		}

		public UUID getFileID() {
			return mFileID;
		}

		public String getFilename() {
			return mFilename;
		}
	}

	/**
	 * Filename and size
	 * TODO
	 * @author Gospodin Gospodinov
	 */
	public final static class FileDescription implements Serializable {
		private static final long serialVersionUID = 410123501656536998L;
	}

	/**
	 * Sequenced file content (fixed block size - 4k)
	 * TODO
	 * @author Gospodin Gospodinov
	 */
	public final static class FileBlock implements Serializable {
		private static final long serialVersionUID = -1141400626063679329L;
	}

	/**
	 * Request block redelivery
	 * TODO
	 * @author Administrator
	 */
	public final static class Redeliver implements Serializable {
		private static final long serialVersionUID = -1520475304449705947L;
	}
}
